﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Boomer.Source.Effect
{
    class EffectManager
    {
        private static EffectManager manager = null;

        private List<CEffect> lisObject;


        EffectManager()
        {
            lisObject = new List<CEffect>();
        }

        public static EffectManager getInstance()
        {
            if (manager == null)
                manager = new EffectManager();

            return manager;
        }

        public void addObject(CEffect pObj)
        {
            lisObject.Add(pObj);
        }

        

        public void update(float deltaTime)
        {
            int count = lisObject.Count;

            for (int i = 0; i < count; ++i)
            {
                if( lisObject[i].m_isAlive)
                    lisObject[i].update(deltaTime);
            }
        }

        public void draw()
        {
            int count = lisObject.Count;

            for (int i = 0; i < count; ++i)
            {
                if (lisObject[i].m_isAlive)
                    lisObject[i].draw();
            }
        }

        public void clear()
        {
            lisObject.Clear();
        }
    }
}
